package com.redfox.newapp.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.redfox.newapp.fragment.AndDevFragment;
import com.redfox.newapp.fragment.DemoFragment;
import com.redfox.newapp.fragment.PhotoFragment;

/**
 * Created by redfox on 2017/3/15.
 */

public class MainPageAdapter extends FragmentStatePagerAdapter {

    public MainPageAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        if (position == 0)
            return PhotoFragment.newInstance("this is test");
        else if (position == 1)
            return AndDevFragment.newInstance("Android");
        else
            return AndDevFragment.newInstance("iOS");
    }

    @Override
    public int getCount() {
        return 3;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        switch (position) {
            case 0:
                return "Photos";
            case 1:
                return "Android";
            case 2:
                return "iOS";
        }
        return "";
    }
}
